package test;

import java.awt.Rectangle;

public class BossPlane{
	public int x;
	public int y;
	public static final int WIDTH=150;
	public static final int HEIGHT=160;
	int q=1;
	public BossPlane(){
		this.x=GameWindows.WIN_WIDTH/2;
		this.y=50;
	}
	@SuppressWarnings("static-access")
	public boolean hit(Bullet bp){
		boolean b=false;
		Rectangle bpRect=new Rectangle(this.x,this.y,this.WIDTH,this.HEIGHT);
		Rectangle bulletRect=new Rectangle(bp.x,bp.y,bp.WIDTH,bp.HEIGHT);
		b=bpRect.intersects(bulletRect);
		return b;
	}
	public void move(){
		this.x+=q;
		if(this.x>=850){
			q=-1;
		}
		if(this.x<=0){
			q=1;
		}
	}
	@SuppressWarnings("static-access")
	public boolean hit(MyPlane mp){
		boolean b=false;
		Rectangle bpRect=new Rectangle(this.x,this.y,this.WIDTH,this.HEIGHT);
		Rectangle mpRect=new Rectangle(mp.x,mp.y,mp.WIDTH,mp.HEIGHT);
		b=mpRect.intersects(bpRect);
		return b;
	}
	public boolean hit1(PlaneTwo pt){
		boolean b=false;
		Rectangle bfRect=new Rectangle(this.x,this.y,this.WIDTH,this.HEIGHT);
		Rectangle mpRect=new Rectangle(pt.x,pt.y,pt.WIDTH,pt.HEIGHT);
		b=mpRect.intersects(bfRect);
		return b;
	}
}
